<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>6.270 - JoyOS: analog.h File Reference</title>
	<link href="main.css" media="screen" rel="Stylesheet" type="text/css"/>
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>  
<body>
	<div id="header">
		<div id="headerb">
		<div id="headtext">
			<span class="titletext">AUTONOMOUS ROBOT DESIGN COMPETITION</span>
			6.270
		</div>
		<div class="mainmenu">
			<a href="http://web.mit.edu/6.270/www">Home</a>
		 	&bull;
			<a href="http://web.mit.edu/6.270/www/about/">About</a> 
		 	&bull;
			<a href="http://web.mit.edu/6.270/www/sponsors/">Sponsors</a>
		 	&bull;
			<a href="http://web.mit.edu/6.270/www/contests/">Past Contests</a> 
		 	&bull;
			<a href="http://web.mit.edu/6.270/www/contestants/">Contestant Information</a>
		</div>
	</div>
	</div>

<div class="maincontent">
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>analog.h File Reference</h1>Analog Inputs. <a href="#_details">More...</a>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0cc981b1d4157633a0651447d48c3b16"></a><!-- doxytag: member="analog.h::ANALOG_MAX" ref="0cc981b1d4157633a0651447d48c3b16" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="analog_8h.html#0cc981b1d4157633a0651447d48c3b16">ANALOG_MAX</a>&nbsp;&nbsp;&nbsp;1023</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Maximum value for an analog reading. <br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="analog_8h.html#7b4d60a805d01f389c353f3876f06d1d">analog_read</a> (uint8_t port)</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The Happyboard has 16 analog inputs. These inputs are fed into a 10 Bit ADC. The ADC communicates with the main processor via SPI, and can do so at 500kHz (20k samples per second.) In reality the actual maximum sample rate is slightly lower due to overheads in the OS code. (Also, the bottleneck analog input sampling is usually processing code, rather than the actual data acquisition).<p>
The analog, digital, and encoder inputs (as well as the LCD) are run off a separate 5V regulated supply. This supply can supply up to 400mA to power the input sensors. <hr><h2>Function Documentation</h2>
<a class="anchor" name="7b4d60a805d01f389c353f3876f06d1d"></a><!-- doxytag: member="analog.h::analog_read" ref="7b4d60a805d01f389c353f3876f06d1d" args="(uint8_t port)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t analog_read           </td>
          <td>(</td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>port</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read an analog port value. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>port</em>&nbsp;</td><td>port number to read (8..23). </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Value read by the analog port (0..1023) </dd></dl>

</div>
</div><p>
</div>
</div>
<div class="maincontent">
	<div class="footer centre">
		<hr>
		Generated on Sun Jan 18 22:59:34 2009 by&nbsp;<a href="http://www.doxygen.org/index.html">Doxygen</a> 1.5.6<br/>
		6.270 Staff, 2008 | 
		<a href="mailto:6.270-organizers@mit.edu">Contact Us</a> | 
		<a href="http://web.mit.edu">MIT</a>
	</div>
</div>
</body>
</html>
